from pyecharts.charts import Bar
from pyecharts import options as opts
import pyecharts
# 内置主题类型可查看 pyecharts.globals.ThemeType
from pyecharts.globals import ThemeType


def test():
    print("版本信息："+pyecharts.__version__)
    bar = Bar()
    bar.add_xaxis(["衬衫", "羊毛衫", "雪纺衫"])
    bar.add_yaxis("商家A", [20, 3, 90])
    bar.render()
    a = 2
    flag = False
    d = 'LuRen'
    b = True
    if a == 2:
        print(d)
    else:
        print(b)
        print(flag)


def bar_test():
    print("版本信息："+pyecharts.__version__)
    a = Bar().add_xaxis(["狗", "猫", "狐狸"]).add_yaxis("动物园", [40, 50, 4])
    a.set_global_opts(title_opts={"title": "主标题", "subtitle": "副标题"})
    # bar.add_xaxis(["衬衫", "羊毛衫", "雪纺衫"])
    # bar.add_yaxis("商家A", [20, 3, 90])
    a.render()
    # render 会⽣成本地 HTML ⽂件，默认会在当前⽬录⽣成 render.html ⽂件
    # 也可以传⼊路径参数，如 bar.render("mycharts.html")


def bar_test2():
    # bar2 = (
    #     Bar(init_opts=opts.InitOpts(theme=ThemeType.DARK))
    #     .add_xaxis(["衬衫", "⽺⽑衫", "雪纺衫", "裤⼦", "⾼跟鞋", "袜⼦"])
    #     .add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
    #     .add_yaxis("商家B", [15, 6, 45, 20, 35, 66])
    #     .set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))
    #     )

    bar3 = Bar(init_opts=opts.InitOpts(theme=ThemeType.DARK))
    bar3.add_xaxis(["衬衫", "⽺⽑衫", "雪纺衫", "裤⼦", "⾼跟鞋", "袜⼦"])
    bar3.add_yaxis("商家A", [5, 20, 36, 10, 75, 90])
    bar3.add_yaxis("商家B", [15, 6, 45, 20, 35, 66])
    bar3.set_global_opts(title_opts=opts.TitleOpts(title="主标题", subtitle="副标题"))
    bar3.set_global_opts({"title": "主标题", "subtitle": "副标题"})
    bar3.render({"path": "LIGHT.html"})

    """
        # LIGHT = "light"
    # DARK = "dark"
    # WHITE = "white"
    # CHALK: str = "chalk"
    # ESSOS: str = "essos"
    # INFOGRAPHIC: str = "infographic"
    # MACARONS: str = "macarons"
    # PURPLE_PASSION: str = "purple-passion"
    # ROMA: str = "roma"
    # ROMANTIC: str = "romantic"
    # SHINE: str = "shine"
    # VINTAGE: str = "vintage"
    # WALDEN: str = "walden"
    # WESTEROS: str = "westeros"
    # WONDERLAND: str = "wonderland"
    # HALLOWEEN: str = "halloween"
    """


bar_test2()
